package com.person.blog.utils;


import com.person.blog.common.ErrorCode;
import com.person.blog.common.ResultBean;


public class ResultUtil {
    public static <T> ResultBean<T> success(T data) {
        return new ResultBean<>(200, data, "ok");
    }
    public static <T> ResultBean<T> success(T data, String msg) {
        return new ResultBean<>(200, data, msg);
    }
    public static  <T> ResultBean<T> error(int code, String msg, String description) {
        return new ResultBean(code, "", msg, description);
    }
    public static  <T> ResultBean<T> error(ErrorCode errorCode, String description) {
        return new ResultBean(errorCode.getCode(), "", errorCode.getMsg(), description);
    }
}
